<template>
	<view>
		
		<view class="u-flex user-box u-p-l-30 u-p-r-30 u-p-b-30 u-p-t-30">
			<view class="u-m-r-10 dax">
				
				<oss-upload></oss-upload>
			</view>
			<view class="u-flex-1">
				<view class="u-font-18 u-p-b-20">{{vuex_user.name}}</view>
				<view class="u-font-14 u-tips-color">邮箱:{{vuex_user.email}}</view>
			</view>
			
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="rmb-circle" title="我的订单"></u-cell-item>
			</u-cell-group>
			<u-cell-group>
				<u-cell-item icon="rmb-circle" title="修改个人信息" @click="towode"></u-cell-item>
			</u-cell-group>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="star" title="我的收藏"></u-cell-item>
				<u-cell-item icon="heart" title="收货地址"></u-cell-item>
			</u-cell-group>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="setting" title="退出登录" @click="tuichu"></u-cell-item>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pic:'https://uviewui.com/common/logo.png',
				show:true
			}
		},
		onLoad() {
			//检测没有token则跳转登录反之进入个人中心
			this.$u.utils.isLogin()
		},
		methods: {
			towode(){
				this.$u.route({
					url:"pages/wode/towode",
				})
			},
			//退出登录
			  async tuichu(){
				//请求api，退出登录
			await this.$u.api.tuichu()	
			
				this.$u.toast('退出成功')
				
				setTimeout(()=>{
					//清除缓存的用户信息
					this.$u.vuex('vuex_token',null)
					this.$u.vuex('vuex_user',{})
					//跳转到首页
					this.$u.route({
						type:'reLaunch',
						url:'pages/index/index'
					})
				},1500)
				
				
				
				
				
				
				
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #ededed;
}

.camera{
	width: 54px;
	height: 44px;
	
	&:active{
		background-color: #ededed;
	}
}
.user-box{
	background-color: #fff;
}
.dax{
	height: 70px;
	width: 70px;
}
</style>
